﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using Moonwish.Workflow.DataEntity;
using Moonwish.Core.DataAccess;

namespace Moonwish.Workflow.DataAccess.SqlServer
{
    public class AddCommand : EntityCommand<T_FLOW_TYPE>
    {
         public AddCommand(DbContext dbContext, List<T_FLOW_TYPE> items, string userId)
            : base(dbContext, items, userId)
        {

        }

        public override void Execute()
        {
            var ovSet = DbContext.Set<T_FLOW_TYPE>();
            foreach (var item in Items)
            {
                var entity = new T_FLOW_TYPE
                {
                    T_FLOW_TYPE_ID = item.T_FLOW_TYPE_ID,
                    TYPE_NAME = item.TYPE_NAME,
                    FATHER_TYPE_ID = item.FATHER_TYPE_ID,
                    REMARK = item.REMARK,
                    ORDER_NO = item.ORDER_NO
                };
                ovSet.Add(entity);
            }
            DbContext.SaveChanges();
        }
    }
}
